import entities, hashlib, datetime

def getCurrent():
    
    hash_id = str(hashlib.md5(str(datetime.date.today())).hexdigest())
    
    stats = entities.Stats.all().filter("hash_id = ", hash_id).get()
    
    if stats == None: stats = entities.Stats(hash_id = hash_id)
    
    return stats

def increment(users = False, invites = False, wishes = False, reservations = False, count = 1):
    
    stats = getCurrent()

    if users: stats.users = stats.users + count;
    if invites: stats.invites = stats.invites + count;
    if wishes: stats.wishes = stats.wishes + count;
    if reservations: stats.reservations = stats.reservations + count;
    
    stats.put()